import {type MockMethod, Recordable} from "vite-plugin-mock";
import {
    deleteAssetUrl,
    loadAssetLevelPageUrl, loadAssetLevelUrl,
    loadAssetPageUrl,
    loadAttributeOfAssetUrl,
    platformTerminalPageUrl,
    platformApplicationPageUrl,
    platformQueryPageUrl, platformTenantPageUrl,
    removeAttributeOfAssetUrl,
    saveAssetUrl,
    saveAttributeOfAssetUrl
} from "../src/apis/url";
import {SERVERS} from "../src/stores/conf";

const PREFIX: string = 'mock';
const MOCK: string = '/mock';

const mock: Array<MockMethod> = [
    {
        url: platformQueryPageUrl('/mock'),
        method: 'post',
        response: () => {
            return {
                code: 0,
                message: "操作成功",
                data: {
                    total: 1,
                    data: [
                        {
                            id: '1',
                            realmId: '1',
                            name: 'E家商城',
                            platformKey: '001023021HEAD',
                            platformSecret: '123456',
                            homeUrl: 'https://www.baidu.com',
                            contact: '李小曼',
                            state: 1,
                            applyDate: '2016-10-10 10:00',
                            roleData: [{
                                id: '1',
                                name: 'root',
                                type: 'role',
                                children: [
                                    {
                                        id: '1-1',
                                        name: 'kid',
                                        type: 'role',
                                    },
                                    {
                                        id: '1-2',
                                        name: 'kid2',
                                        type: 'role',
                                    }
                                ]
                            },
                                {
                                    id: '2',
                                    name: 'root2',
                                    type: 'role',
                                }
                            ]
                        },
                        {
                            id: '2',
                            realmId: 'default',
                            name: ' 支付平台',
                            platformKey: 'W001023021HEAD00',
                            platformSecret: '223456',
                            homeUrl: 'http://apptest.licode.com',
                            contact: '王晓梅',
                            state: 0,
                            applyDate: '2016-10-12 10:00',
                        }
                    ]
                }
            }
        }
    },
    {
        url: platformTerminalPageUrl('/mock'),
        method: 'post',
        response: (opt: {
            url: Recordable;
            body: Recordable;
            query: Recordable;
            headers: Recordable;
        }) => {
            const data: any = [];
            data.push({
                id: '1',
                name: '小程序',
                code: 'mp',
                state: 1,
                createTime: '2016-09-09 10:09',
            });
            data.push({
                id: '2',
                name: 'H5应用',
                code: 'h5',
                state: 0,
                createTime: '2016-09-09 10:09',
            });
            return {
                code: 0,
                message: "操作成功",
                data: {
                    total: data.length,
                    data: data
                }
            }
        }
    },
    {
        url: platformApplicationPageUrl('/mock'),
        method: 'post',
        response: (opt: {
            url: Recordable;
            body: Recordable;
            query: Recordable;
            headers: Recordable;
        }) => {
            const data: any = [];
            data.push({
                id: '1',
                name: '智能家电',
                owner: '接口测试',
                state: 0,
                createTime: '2016-09-09 10:09',
            });
            return {
                code: 0,
                message: "操作成功",
                data: {
                    total: data.length,
                    data: data
                }
            }
        }
    },
    {
        url: platformTenantPageUrl('/mock'),
        method: 'post',
        response: (opt: {
            url: Recordable;
            body: Recordable;
            query: Recordable;
            headers: Recordable;
        }) => {
            const data: any = [];
            data.push({
                id: '1',
                name: '支付平台',
                owner: '支付平台',
                state: '0',
                createTime: '2016-09-09 10:09',
            });
            data.push({
                id: '2',
                name: '樱花商城',
                owner: '樱花商城',
                state: '0',
                createTime: '2016-09-09 10:09',
            });
            data.push({
                id: '3',
                name: '转转卖场',
                owner: '转转卖场',
                state: '0',
                createTime: '2016-09-09 10:09',
            });
            return {
                code: 0,
                message: "操作成功",
                data: {
                    total: data.length,
                    data: data
                }
            }
        }
    },
    {
        url: loadAssetLevelPageUrl('/mock'),
        method: 'post',
        response: (opt: {
            url: Recordable;
            body: Recordable;
            query: Recordable;
            headers: Recordable;
        }) => {
            let data: any = [];
            if (opt.body.server === SERVERS.REALM) {
                if ('1' === opt.body.targetId) {
                    if ('GROUP' === opt.body.assetType) {
                        if (!opt.body.parentId) {
                            data = [
                                {
                                    id: '1',
                                    parentId: undefined,
                                    name: '采购部',
                                    applyDate: '2016-10-10',
                                    state: 0,
                                },
                                {
                                    id: '2',
                                    parentId: undefined,
                                    name: '市场部',
                                    applyDate: '2016-10-10',
                                    state: 0,
                                },
                                {
                                    id: '3',
                                    parentId: undefined,
                                    name: '人事部',
                                    applyDate: '2016-10-10',
                                    state: 0,
                                }
                            ]
                        } else if ("1" === opt.body.parentId) {
                            data = [{
                                id: '1-1',
                                parentId: '1',
                                name: 'JAVA开发',
                                applyDate: '2016-10-10',
                            }];
                        }
                    }

                } else if ('2' === opt.body.targetId) {
                    if ('GROUP' === opt.body.assetType) {
                        if (!opt.body.parentId) {
                            data = [
                                {
                                    id: '1',
                                    parentId: undefined,
                                    name: '采购部',
                                    applyDate: '2016-10-10',
                                    state: 0,
                                },
                                {
                                    id: '2',
                                    parentId: undefined,
                                    name: '市场部',
                                    applyDate: '2016-10-10',
                                    state: 0,
                                },
                            ]
                        } else if ("1" === opt.body.parentId) {
                            data = [{
                                id: '1-1',
                                parentId: '1',
                                name: 'JAVA开发222',
                                applyDate: '2016-10-10',
                            }];
                        }
                    }

                }
            } else {
                if ('1' === opt.body.targetId) {
                    if ('GROUP' === opt.body.assetType) {
                        if (!opt.body.parentId) {
                            data = [{
                                id: '1',
                                parentId: undefined,
                                name: '技术部',
                                applyDate: '2016-10-10',
                            },
                                {
                                    id: '2',
                                    parentId: undefined,
                                    name: '采购部',
                                    applyDate: '2016-10-10',
                                    state: 0,
                                },
                                {
                                    id: '3',
                                    parentId: undefined,
                                    name: '市场部',
                                    applyDate: '2016-10-10',
                                    state: 0,
                                },
                                {
                                    id: '4',
                                    parentId: undefined,
                                    name: '人事部',
                                    applyDate: '2016-10-10',
                                    state: 0,
                                }
                            ]
                        } else {
                            if ("1" === opt.body.parentId) {
                                data = [{
                                    id: '1-1',
                                    parentId: '1',
                                    name: 'JAVA开发',
                                    applyDate: '2016-10-10',
                                },
                                    {
                                        id: '1-2',
                                        parentId: '1',
                                        name: '手机APP',
                                        applyDate: '2016-10-10',
                                    },
                                    {
                                        id: '1-3',
                                        parentId: '1',
                                        name: 'WEB前端',
                                        applyDate: '2016-10-10',
                                    },
                                    {
                                        id: '1-4',
                                        parentId: '1',
                                        name: '嵌入式开发',
                                        applyDate: '2016-10-10',
                                    },
                                ]
                            } else if ("2" === opt.body.parentId) {
                                data = [{
                                    id: '2-1',
                                    parentId: '2',
                                    name: '数码一部',
                                    applyDate: '2016-10-10',
                                },
                                    {
                                        id: '2-2',
                                        parentId: '2',
                                        name: '家电',
                                        applyDate: '2016-10-10',
                                    },
                                    {
                                        id: '2-3',
                                        parentId: '2',
                                        name: '办公用品',
                                        applyDate: '2016-10-10',
                                    },
                                ]
                            }
                        }
                    } else if ('ROLE' === opt.body.assetType) {
                        if (!opt.body.parentId) {
                            data = [
                                {
                                    id: '1',
                                    name: '管理员',
                                    code: 'admin',
                                    group: '',
                                    comment: '系统管理员',
                                    state: 1,
                                    updateTime: '2016-10-08 12:01',
                                    createTime: '2016-10-01 11:01'
                                },
                                {
                                    id: '2',
                                    name: '总部',
                                    code: 'eng',
                                    group: '',
                                    comment: '总部',
                                    state: 1,
                                    updateTime: '2016-10-08 12:01',
                                    createTime: '2016-10-01 11:01'
                                }
                            ]
                        } else {
                            if ("1" === opt.body.parentId) {
                                data = [
                                    {
                                        id: '1-1',
                                        name: '总经理',
                                        code: 'admin',
                                        parentId: '1',
                                        group: '',
                                        comment: '总经理',
                                        state: 1,
                                        updateTime: '2016-10-08 12:01',
                                        createTime: '2016-10-01 11:01'
                                    },
                                    {
                                        id: '1-2',
                                        name: '总监',
                                        code: 'admin',
                                        parentId: '1',
                                        group: '',
                                        comment: '总经理',
                                        state: 1,
                                        updateTime: '2016-10-08 12:01',
                                        createTime: '2016-10-01 11:01'
                                    }
                                ]
                            }
                        }
                    } else if ('CLIENT' === opt.body.assetType) {
                        data = [
                            {
                                id: '1',
                                code: '888888',
                                name: '商城平台',
                                accessTimeout: 300,
                                refreshTimeout: 300,
                                state: 1,
                                updateTime: '2016-10-08 10:01',
                                createTime: '2016-10-01 10:01'
                            },
                            {
                                id: '2',
                                code: '5555',
                                name: 'APP访问',
                                accessTimeout: 200,
                                refreshTimeout: 300,
                                state: 1,
                                updateTime: '2016-10-08 10:01',
                                createTime: '2016-10-01 10:01'
                            }
                        ]
                    } else if ('PERMIT' === opt.body.assetType) {
                        data = [
                            {
                                id: '1',
                                code: 'user:add',
                                name: '增加',
                                state: 1,
                                comment: '增加用户',
                                updateTime: '2016-10-08 10:01',
                                createTime: '2016-10-01 10:01'
                            },
                            {
                                id: '2',
                                code: 'user:del',
                                name: '删除',
                                state: 1,
                                comment: '删除用户',
                                updateTime: '2016-10-08 10:01',
                                createTime: '2016-10-01 10:01'
                            },
                            {
                                id: '3',
                                code: 'user:edit',
                                name: '编辑',
                                state: 1,
                                comment: '编辑用户',
                                updateTime: '2016-10-08 10:01',
                                createTime: '2016-10-01 10:01'
                            }
                        ]
                    } else {
                        data = [];
                    }
                }
            }

            return {
                code: 0,
                message: "操作成功",
                data: {
                    total: data.length,
                    data: data
                }
            }
        }
    },
    {
        url: `/${PREFIX}/api/platform/save`,
        method: 'post',
        response: () => {
            return {
                code: 0,
                message: "操作成功"
            }
        }
    },
    {
        url: `/${PREFIX}/api/platform/user/groups/load`,
        method: 'post',
        response: (opt: {
            url: Recordable;
            body: Recordable;
            query: Recordable;
            headers: Recordable;
        }) => {
            return {
                code: 0,
                message: "操作成功",
                data: {
                    data: [
                        {
                            id: '1',
                            parentId: undefined,
                            name: '研发部',
                            realmName: "默认领域",
                            createTime: '2016-10-10',
                            state: 1
                        },
                        {
                            id: '2',
                            parentId: undefined,
                            name: '市场部',
                            realmName: "默认领域",
                            createTime: '2016-10-11',
                            state: 1,
                            children: [
                                {
                                    id: '21',
                                    parentId: undefined,
                                    name: 'JAVA组',
                                    realmName: "默认领域",
                                    createTime: '2016-10-11',
                                    state: 1,
                                },
                                {
                                    id: '22',
                                    parentId: undefined,
                                    name: '测试组',
                                    realmName: "默认领域",
                                    createTime: '2016-10-11',
                                    state: 1,
                                }
                            ]
                        }]
                }
            }
        }
    },
    {
        url: loadAssetPageUrl(MOCK),
        method: 'post',
        response: (opt: {
            url: Recordable;
            body: Recordable;
            query: Recordable;
            headers: Recordable;
        }) => {
            let data: any;
            if ('1' === opt.body.targetId) {
                if ('GROUP' === opt.body.type) {
                    if (!opt.body.parentId) {
                        data = [{
                            id: '1',
                            parentId: undefined,
                            name: '技术部',
                            applyDate: '2016-10-10',
                        },
                            {
                                id: '2',
                                parentId: undefined,
                                name: '采购部',
                                applyDate: '2016-10-10',
                                state: 0,
                            },
                            {
                                id: '3',
                                parentId: undefined,
                                name: '市场部',
                                applyDate: '2016-10-10',
                                state: 0,
                            },
                            {
                                id: '4',
                                parentId: undefined,
                                name: '人事部',
                                applyDate: '2016-10-10',
                                state: 0,
                            }
                        ]
                    } else {
                        if ("1" === opt.body.parentId) {
                            data = [{
                                id: '1-1',
                                parentId: '1',
                                name: 'JAVA开发',
                                applyDate: '2016-10-10',
                            },
                                {
                                    id: '1-2',
                                    parentId: '1',
                                    name: '手机APP',
                                    applyDate: '2016-10-10',
                                },
                                {
                                    id: '1-3',
                                    parentId: '1',
                                    name: 'WEB前端',
                                    applyDate: '2016-10-10',
                                },
                                {
                                    id: '1-4',
                                    parentId: '1',
                                    name: '嵌入式开发',
                                    applyDate: '2016-10-10',
                                },
                            ]
                        } else if ("2" === opt.body.parentId) {
                            data = [{
                                id: '2-1',
                                parentId: '2',
                                name: '数码一部',
                                applyDate: '2016-10-10',
                            },
                                {
                                    id: '2-2',
                                    parentId: '2',
                                    name: '家电',
                                    applyDate: '2016-10-10',
                                },
                                {
                                    id: '2-3',
                                    parentId: '2',
                                    name: '办公用品',
                                    applyDate: '2016-10-10',
                                },
                            ]
                        }
                    }
                } else if ('ROLE' === opt.body.type) {
                    if (!opt.body.parentId) {
                        data = [
                            {
                                id: '1',
                                name: '管理员',
                                code: 'admin',
                                group: '',
                                comment: '系统管理员',
                                state: 1,
                                updateTime: '2016-10-08 12:01',
                                createTime: '2016-10-01 11:01'
                            },
                            {
                                id: '2',
                                name: '总部',
                                code: 'eng',
                                group: '',
                                comment: '总部',
                                state: 1,
                                updateTime: '2016-10-08 12:01',
                                createTime: '2016-10-01 11:01'
                            }
                        ]
                    } else {
                        if ("1" === opt.body.parentId) {
                            data = [
                                {
                                    id: '1-1',
                                    name: '总经理',
                                    code: 'admin',
                                    parentId: '1',
                                    group: '',
                                    comment: '总经理',
                                    state: 1,
                                    updateTime: '2016-10-08 12:01',
                                    createTime: '2016-10-01 11:01'
                                },
                                {
                                    id: '1-2',
                                    name: '总监',
                                    code: 'admin',
                                    parentId: '1',
                                    group: '',
                                    comment: '总经理',
                                    state: 1,
                                    updateTime: '2016-10-08 12:01',
                                    createTime: '2016-10-01 11:01'
                                }
                            ]
                        }
                    }
                } else if ('MENU' === opt.body.type) {
                    data = [{
                        id: '1',
                        parentId: undefined,
                        name: '首页',
                        applyDate: '2016-10-10',
                        state: 1,
                        order: 1,
                        type: 1,
                        hidden: 1,
                    },
                        {
                            id: '2',
                            parentId: undefined,
                            name: '资源管理',
                            applyDate: '2016-10-10',
                            state: 1,
                            order: 1,
                            type: 0,
                            hidden: 1,
                            children: [
                                {
                                    id: '2-1',
                                    parentId: "2",
                                    name: '客户管理',
                                    code: 'develop',
                                    order: 1,
                                    type: 1,
                                    applyDate: '2016-10-10',
                                    routeUrl: '/system-manager/client',
                                    componentUrl: '/system/client',
                                    state: 0,
                                    children: [
                                        {
                                            id: '2-1-1',
                                            parentId: "2-1",
                                            name: '分配',
                                            code: 'assign',
                                            order: 1,
                                            type: 2,
                                            state: 0,
                                        },
                                        {
                                            id: '2-1-2',
                                            parentId: "2-1",
                                            name: '删除',
                                            code: 'delete',
                                            order: 1,
                                            type: 2,
                                            state: 0,
                                        },
                                    ]
                                },
                                {
                                    id: '2-2',
                                    parentId: "2",
                                    name: '角色管理',
                                    code: 'develop',
                                    order: 2,
                                    type: 1,
                                    routeUrl: '/system-manager/role',
                                    componentUrl: '/system/role',
                                    applyDate: '2016-10-10',
                                    state: 0,
                                }
                            ]
                        }]
                } else if ('CLIENT' === opt.body.type) {
                    data = [
                        {
                            id: '1',
                            code: '888888',
                            name: '商城平台',
                            accessTimeout: 300,
                            refreshTimeout: 300,
                            state: 1,
                            updateTime: '2016-10-08 10:01',
                            createTime: '2016-10-01 10:01'
                        },
                        {
                            id: '2',
                            code: '5555',
                            name: 'APP访问',
                            accessTimeout: 200,
                            refreshTimeout: 300,
                            state: 1,
                        },
                    ]
                } else if ('PERMIT' === opt.body.type) {
                    data = [
                        {
                            id: '1',
                            code: 'user:add',
                            name: '增加',
                            state: 1,
                            comment: '增加用户',
                            updateTime: '2016-10-08 10:01',
                            createTime: '2016-10-01 10:01'
                        },
                        {
                            id: '2',
                            code: 'user:del',
                            name: '删除',
                            state: 1,
                            comment: '删除用户',
                            updateTime: '2016-10-08 10:01',
                            createTime: '2016-10-01 10:01'
                        },
                        {
                            id: '3',
                            code: 'user:edit',
                            name: '编辑',
                            state: 1,
                            comment: '编辑用户',
                            updateTime: '2016-10-08 10:01',
                            createTime: '2016-10-01 10:01'
                        }
                    ]
                } else {
                    data = [];
                }
            }

            return {
                code: 0,
                message: "操作成功",
                data: {
                    data: data
                }
            }
        }
    },
    {
        url: `/${PREFIX}/api/platform/log/audit/page/load`,
        method: 'post',
        response: () => {
            return {
                code: 0,
                message: "操作成功",
                data: {
                    total: 1,
                    data: [
                        {
                            id: '1',
                            tenant: '生产二部',
                            client: '移动端',
                            opType: 'add',
                            failInfo: 'fail',
                            opTime: '2016-10-16'
                        },
                    ]
                }
            }
        }
    },
    {
        url: `/${PREFIX}/api/platform/log/call/page/load`,
        method: 'post',
        response: () => {
            return {
                code: 0,
                message: "操作成功",
                data: {
                    total: 1,
                    data: [
                        {
                            id: '1',
                            tenant: '生产二部',
                            client: '移动端',
                            callType: 'POST',
                            costTime: '20',
                            callTime: '2016-10-16'
                        },
                    ]
                }
            }
        }
    },
    {
        url: `/${PREFIX}/api/platform/log/login/page/load`,
        method: 'post',
        response: () => {
            return {
                code: 0,
                message: "操作成功",
                data: {
                    total: 1,
                    data: [
                        {
                            id: '1',
                            tenant: '生产二部',
                            client: '移动端',
                            role: '管理员',
                            browser: 'IE',
                            loginTime: '2016-10-16'
                        }
                    ]
                }
            }
        }
    },
    {
        url: `/${PREFIX}/api/platform/log/system/page/load`,
        method: 'post',
        response: () => {
            return {
                code: 0,
                message: "操作成功",
                data: {
                    total: 1,
                    data: [
                        {
                            id: '1',
                            name: '李小曼',
                            logTime: '2016-08-01',
                            content: '用户登录'
                        },
                    ]
                }
            }
        }
    },
    {
        url: loadAttributeOfAssetUrl('/mock'),
        method: 'post',
        response: (opt: {
            url: Recordable;
            body: Recordable;
            query: Recordable;
            headers: Recordable;
        }) => {
            const data: any = {};

            if ('USER' === opt.body.assetType) {
                if ('1' === opt.body.assetId) {
                    data['name'] = 'licode';
                    data['idFront'] = 'http://1.jpg';
                } else if ('2' === opt.body.assetId) {
                    data['name'] = 'wangrong';
                    data['idFront'] = 'http://2.jpg';
                    data['address'] = '贵州贵阳';
                }
            } else if ('ROLE' === opt.body.assetType) {
                if ('1' === opt.body.assetId) {
                    data['test'] = '123';
                } else if ('2' === opt.body.assetId) {
                    data['test'] = '56789';
                }
            } else if ('PERMIT' === opt.body.assetType) {
                if ('1' === opt.body.assetId) {
                    data['test'] = '568';
                } else if ('2' === opt.body.assetId) {
                    data['test'] = '23456';
                }
            } else if ('MENU' === opt.body.assetType) {
                if ('1' === opt.body.assetId) {
                    data['icon'] = 'refresh';
                }
            } else if ('GROUP' === opt.body.assetType) {
                if ('1' === opt.body.assetId) {
                    data['depart'] = '测试';
                } else if ('2' === opt.body.assetId) {
                    data['count'] = 23;
                }
            }
            return {
                code: 0,
                message: "操作成功",
                data: {
                    assetId: opt.body.assetId,
                    assetType: opt.body.asset,
                    props: data
                }
            }
        }
    },
    {
        url: saveAttributeOfAssetUrl('/mock'),
        method: 'post',
        response: () => {
            return {
                code: 0,
                message: "操作成功",
                data: {}
            }
        }
    },
    {
        url: removeAttributeOfAssetUrl('/mock'),
        method: 'post',
        response: () => {
            return {
                code: 0,
                message: "操作成功",
                data: {}
            }
        }
    },
    {
        url: saveAssetUrl('/mock'),
        method: 'post',
        response: () => {
            return {
                code: 1,
                message: "数据格式错误"
            }
        }
    },
    {
        url: deleteAssetUrl('/mock'),
        method: 'post',
        response: () => {
            return {
                code: 0,
                message: "操作成功"
            }
        }
    },
    {
        url: loadAssetLevelUrl('/mock'),
        method: 'post',
        response: (opt: {
            url: Recordable;
            body: Recordable;
            query: Recordable;
            headers: Recordable;
        }) => {
            let data: any;

            if ('ROLE' === opt.body.assetType) {
                data = [
                    {
                        id: '1',
                        name: '超级管理员',
                        code: 'admin',
                        group: '',
                        comment: '系统超级管理员',
                        state: 1,
                        updateTime: '2016-10-08 12:01',
                        createTime: '2016-10-01 11:01'
                    }
                ]
            } else if ('GROUP' === opt.body.assetType) {
                data = [{
                    id: '1',
                    parentId: undefined,
                    name: '小码科技',
                    applyDate: '2016-10-10',
                    state: 1,
                    children: [
                        {
                            id: '2',
                            parentId: "1",
                            name: '采购部',
                            applyDate: '2016-10-10',
                            state: 0,
                        }
                    ]
                }]
            } else if ('MENU' === opt.body.assetType) {
                data = [{
                    id: '1',
                    parentId: undefined,
                    name: '首页',
                    applyDate: '2016-10-10',
                    state: 1,
                    menuOrder: 1,
                    menuType: 1,
                },
                    {
                        id: '2',
                        parentId: undefined,
                        name: '资源管理',
                        applyDate: '2016-10-10',
                        state: 1,
                        menuOrder: 1,
                        menuType: 0,
                        children: [
                            {
                                id: '2-1',
                                parentId: "2",
                                name: '客户管理',
                                code: 'develop',
                                menuOrder: 1,
                                menuType: 1,
                                applyDate: '2016-10-10',
                                routeUrl: '/system-manager/client',
                                componentUrl: '/system/client',
                                children: [
                                    {
                                        id: '2-1-1',
                                        name: '分配',
                                        code: 'assign',
                                        menuType: 2,
                                    },
                                    {
                                        id: '2-1-2',
                                        name: '删除',
                                        code: 'delete',
                                        menuType: 2,
                                    },
                                    {
                                        id: '2-1-3',
                                        name: '查询',
                                        code: 'query',
                                        menuType: 2,
                                    },
                                    {
                                        id: '2-1-4',
                                        name: '查询',
                                        code: 'query',
                                        menuType: 2,
                                    },
                                    {
                                        id: '2-1-5',
                                        name: '查询',
                                        code: 'query',
                                        menuType: 2,
                                    },
                                    {
                                        id: '2-1-6',
                                        name: '查询',
                                        code: 'query',
                                        menuType: 2,
                                    },
                                    {
                                        id: '2-1-7',
                                        name: '查询',
                                        code: 'query',
                                        menuType: 2,
                                    },
                                    {
                                        id: '2-1-8',
                                        name: '查询',
                                        code: 'query',
                                        menuType: 2,
                                    },
                                ]
                            },
                            {
                                id: '2-2',
                                parentId: "2",
                                name: '角色管理',
                                code: 'develop',
                                menuOrder: 2,
                                menuType: 1,
                                routeUrl: '/system-manager/role',
                                componentUrl: '/system/role',
                                applyDate: '2016-10-10',
                                children: [
                                    {
                                        id: '2-2-1',
                                        name: '分配',
                                        code: 'assign',
                                        menuType: 2,
                                    },
                                    {
                                        id: '2-2-2',
                                        name: '删除',
                                        code: 'delete',
                                        menuType: 2,
                                    },
                                ]
                            }
                        ]
                    }]
            } else if ('CLIENT' === opt.body.assetType) {
                data = [
                    {
                        id: '1',
                        code: '888888',
                        name: '商城平台',
                        accessTimeout: 300,
                        refreshTimeout: 300,
                        state: 1,
                        updateTime: '2016-10-08 10:01',
                        createTime: '2016-10-01 10:01'
                    }
                ]
            } else if ('PERMIT' === opt.body.assetType) {
                data = [
                    {
                        id: '1',
                        code: '22222',
                        name: '删除用户',
                        state: 1,
                        comment: '删除用户',
                        updateTime: '2016-10-08 10:01',
                        createTime: '2016-10-01 10:01'
                    }
                ]
            } else {
                data = [];
            }

            return {
                code: 0,
                message: "操作成功",
                data: data
            }
        }
    },
]

export default mock;
